package com.xxg.renrenlogin.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 店铺Dao
 *
 * @author xuxiaogang
 * @date 2021-11-17
 */
@Mapper
@Component
public interface RenrenShopShopDao {
    /**
     * 根据用户ID查询店铺ID
     *
     * @param userId 用户ID
     * @return 店铺ID
     */
    @Select("select id from renren_shop_shop where user_id = #{userId} and audit_status=10 and is_deleted = 0 and is_trial = 0 limit 1")
    RenrenShopShop selectByUserId(@Param("userId") int userId);

    /**
     * 查询店铺信息表
     *
     * @return 店铺信息表
     */
    @Select("select id,user_id as userId from renren_shop_shop where audit_status=10 and is_deleted = 0 and is_trial = 0")
    List<RenrenShopShop> selectAll();
}